package com.example.springboot.mqtt.util;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
@Slf4j
public class ProjectExceptionAdvice {
    @ExceptionHandler
    public R doException(Exception e){
        //记录日志
        //通知运维
        //通知开发
        log.error("服务器故障，请联系管理员",e);
        e.printStackTrace();
        return new R(false,"服务器故障，请联系管理员");
    }
}
